/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package RunableSt;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Anatomy
 */
class Counter {
public static long count = 0;
}class UseCounter implements Runnable {

    @Override
public void run() { 
 for (;;) {
    
            try {
                Counter.count++;
                Thread.sleep(1000);
              System.out.println("Thread1");
            }
            //}
            catch (InterruptedException ex) {
                Logger.getLogger(UseCounter.class.getName()).log(Level.SEVERE, null, ex);
            }
    
 }



//}
}
}
class Counter1 {
public static long count = 0;
}class UseCounter1 implements Runnable {

    @Override
public void run() { 
 for (;;) {
    
            try {
                Counter.count++;
                Thread.sleep(1000);
              System.out.println("Thread2");
            }
            //}
            catch (InterruptedException ex) {
                Logger.getLogger(UseCounter.class.getName()).log(Level.SEVERE, null, ex);
            }
    
 }



//}
}
}
class Counter2 {
public static long count = 0;
}class UseCounter2 implements Runnable {

    @Override
public void run() { 
 for (;;) {
    
            try {
                Counter.count++;
                Thread.sleep(1000);
              System.out.println("Thread3");
            }
            //}
            catch (InterruptedException ex) {
                Logger.getLogger(UseCounter.class.getName()).log(Level.SEVERE, null, ex);
            }
    
 }



//}
}
}
 class DataRace {
public static void main(String args[]) { 
UseCounter c = new UseCounter();
UseCounter1 d = new UseCounter1();
UseCounter2 e = new UseCounter2();
Thread t1 = new Thread(c);
Thread t2 = new Thread(d);
Thread t3 = new Thread(e);
t1.start();
t2.start();
t3.start();


}}